package com.ymatou.iapi.anlimember.enums;

import java.util.Arrays;

public enum MemberTypeEnum {

	ANLI(2, "安利会员"),
    HAITAO_DAREN(3, "海淘达人会员");

    private final int code;

    private final String msg;

    MemberTypeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static MemberTypeEnum findByCode(int code) {
        return Arrays.stream(MemberTypeEnum.values()).filter(m -> m.getCode() == code)
                .findFirst().orElseThrow(() -> new RuntimeException("Code不存在"));
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
